<template>
	<view class="mainCon">
		<view class="headForm">
			<u-form :model="formData" ref="uForm" label-width="160">
				<u-form-item label="船舶名称">
					<u-input v-model="formData.bargenam" />
				</u-form-item>
				<u-form-item label="船舶识别码">
					<u-input v-model="formData.shipsbcod" />
				</u-form-item> 
				<u-form-item label="审核状态" label-width="160">
					<u-input type="select" :select-open="shShow" v-model="formData.checkStatusLabel"
						placeholder="审核状态" @click="shShow = true"></u-input>
				</u-form-item>
				<u-form-item label="黑白名单" label-width="160">
					<u-input type="select" :select-open="jsShow" v-model="formData.statusLabel"
						placeholder="黑白名单" @click="jsShow = true"></u-input>
				</u-form-item>
			</u-form> 
			<view class="btnGroup">
				<u-button :custom-style="customStyle" type="primary" @click="onInsert">新增</u-button>
				<u-button :custom-style="customStyle" type="primary" @click="onSearch">查询</u-button>  
			</view>
		</view>
		<view style="height: 430rpx;"></view>
		<view class="orderList">
			<view class="orderItem" v-for="(item,index) in orderList">
				<view class="orderHead">
					<view class="headcell">
						<view class="dateLabel">
							船舶名称 : {{ item.bargenam }}
						</view>
					</view>
					<view class="headcell">
						<view class="dateLabel">
							曾用名 : {{ item.oldbargenam ? item.oldbargenam : '' }}
						</view>
					</view>
				</view>
				<view class="orderInfo">
					<view class="infoCell">
						<view class="labelName">
							船舶识别码 : 
						</view>
						<view class="infoCon">
							{{ item.shipsbcod }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							黑白名单 : 
						</view>
						<view class="infoCon">
							<view v-if="item.status == 1">白名单</view>
							<view v-if="item.status == 2">黑名单</view>
						</view>
					</view> 
					<view class="infoCell">
						<view class="labelName">
							审核状态 : 
						</view>
						<view class="infoCon">
							<!-- {{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss') }} -->
							<view v-if="item.checkStatus == 1">待审核</view>
							<view v-if="item.checkStatus == 2">已审核</view>
							<view v-if="item.checkStatus == 3">已驳回</view>
						</view>
					</view> 
					<view class="infoCell">
						<view class="labelName">
							船舶长度 : 
						</view>
						<view class="infoCon">
							{{ item.shiplength }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							船舶宽度 : 
						</view>
						<view class="infoCon">
							{{ item.shipwidth }}
						</view>
					</view>
					<view class="infoCell">
						<view class="labelName">
							A级航区舷 : 
						</view>
						<view class="infoCon">
							{{ item.freeboard }}
						</view>	
					</view>
					<view style="display: flex; justify-content: center; margin-top: 8px;">
						<view class="btn" @click="toMoreInfo(item)">查看</view>
						<view class="btn" @click="toThroughSW(item)">修改</view>
						<view class="btn" v-if="manageShow" style="width: 200rpx;" @click="toThrough(item)">黑白名单切换</view>
						<view class="btn" @click="toParse(item)">删除</view>
					</view>
					
				</view>
			</view>
		</view>
		
		<view style="margin-top: 200rpx;" v-if="orderList.length ===0">
			<u-empty text="暂无数据" mode="list"></u-empty>
		</view>
		<u-popup v-model="showInfo" width="100%" height="100%" :closeable="true">
			<view style="margin: 15px;">
				<view style="text-align: center;font-size: 20px;
						font-weight: 700;">
					详细信息
				</view>
				<view class="content">
					<u-form :model="form" ref="Form" label-width="210">
						<u-form-item label="船舶名称" prop="bargenam">
							<view style="display: flex; align-items: center;">
								<u-input v-model="form.bargenam" /> 
								<view class="btn" @click="onConfirm" style="display: inline-block;">查 询</view>
							</view>
						</u-form-item>
						<u-form-item label="船舶曾用名" prop="oldbargenam">
							<u-input v-model="form.oldbargenam" />
						</u-form-item>
						<u-form-item label="船舶识别码" prop="shipsbcod">
							<u-input v-model="form.shipsbcod" />
						</u-form-item>
						 <u-form-item label="船舶总长" prop="shiplength">
						 	<u-input v-model="form.shiplength"/>
						 </u-form-item>
						 <u-form-item label="船舶宽度" prop="shipwidth">
						 	<u-input v-model="form.shipwidth"/>
						 </u-form-item>
						 <u-form-item label="核定干舷" prop="freeboard">
						 	<u-input v-model="form.freeboard"/>
						 </u-form-item>
						 <u-form-item label="船籍港" prop="shipregistport">
						 	<u-input v-model="form.shipregistport" />
						 </u-form-item>
						 <u-form-item label="船舶总吨" prop="shipnet">
						 	<u-input v-model="form.shipnet" />
						 </u-form-item>
						 <u-form-item label="满载吃水" prop="shipdraft">
						 	<u-input v-model="form.shipdraft"/>
						 </u-form-item>
						 <u-form-item label="参考载货量" prop="loadtonnage">
						 	<u-input v-model="form.loadtonnage"/>
						 </u-form-item>
						 <u-form-item label="船舶所有人" prop="shipoper">
						 	<u-input v-model="form.shipoper" />
						 </u-form-item>
						 <u-form-item label="船舶经营人" prop="shipcorp">
						 	<u-input v-model="form.shipcorp" />
						 </u-form-item>
						 <u-form-item label="MMSI码" prop="mmsicod">
						 	<u-input v-model="form.mmsicod" />
						 </u-form-item>
						 <u-form-item label="最大高度" prop="maximumheight">
						 	<u-input v-model="form.maximumheight" />
						 </u-form-item>
						 
						 <u-form-item label="船舶建造日期:" prop="shipbuilddate">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin1 = true">{{ form.shipbuilddate }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="船籍证有效期:" prop="cjzsyxq">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin2 = true">{{ form.cjzsyxq }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="适航证有效期:" prop="shzsyxq">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin3 = true">{{ form.shzsyxq }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="电台执照有效期:" prop="diantaiDate">
						 	<u-button  :custom-style="customTimeStyle" @click="showBegin4 = true">{{ form.diantaiDate }}</u-button>
						 </u-form-item>
						 
						 <u-form-item label="备注" prop="memo">
						 	<u-input v-model="form.memo" type="textarea"/>
						 </u-form-item>
						 
						 <u-form-item label="状态">
							 <view>{{ stateShow }}</view>
						 </u-form-item>
						 
						 <u-form-item label="驳回原因">
						 	<view>{{ form.checkMemo ? form.checkMemo : '' }}</view>
						 </u-form-item>
						 
						 <u-form-item label="图片上传"  v-if="!insertshow">
							 <u-upload :auto-upload="true" ref="uUpload"  :action="action"  name="file" 
								@on-success="handleSuccess" :before-upload="beforeUpload" :size-type="['compressed']" @on-remove="handleRemove" max-count="100" >
							 </u-upload>
						 </u-form-item>
						 <u-form-item  label="已上传的图片" v-if="upPicShow">
							<view v-for="(item, index) in fileDate1" :key="item.id" class="pic">
								<view id="finsihPic">
									<view style="text-align: center;">{{ item.name }}</view>
									<u-image @click="previewImage(item, index, 1)" :lazy-load="true" width="100px" height="100px" :src="item.url"></u-image>
									<view class="btn" style="background-color: #ff4949;" @click="deletePic(item)">删除</view>
								</view>
							</view>
						 </u-form-item>
					</u-form>
					<u-divider v-if="insertshow "  half-width="250" border-color="#6d6d6d">驳船附件</u-divider>
					<view class="picContent" v-if="insertshow" >
						<view v-for="(item, index) in fileDate1" :key="item.id" class="pic">
							<view style="text-align: center;">{{ item.name }}</view>
							<u-image @click="previewImage(item, index, 1)" :lazy-load="true" width="100px" height="100px" :src="item.url"></u-image>	
						</view>
					</view>
					<view v-if="insertshow && manageShow" style="display: flex; justify-content: center;height:100rpx; margin-top: 8px;">
						<view class="btn" @click="toSH(form)">审核</view>
						<view class="btn" @click="toResolve(form)">反审核</view>
					</view>
					
					<view v-if="!insertshow" style="display: flex; justify-content: center;height:100rpx; margin-top: 8px;">
						<view class="btn" @click="submit()">确 定</view>
						<view class="btn" @click="showInfo = false">取 消</view>
					</view>
					
				</view>
			</view>
		</u-popup>
		<u-modal v-model="showReason" content="驳回原因" title="确定驳回吗" :show-cancel-button="true"
			@confirm="throughConfirm" @cancel="showReason=false">
			<u-form  label-width="100px">
				<u-form-item label="驳回原因:" >
					<u-input v-model="reason" placeholder="请输入者拒绝的理由"/>
				</u-form-item>
			</u-form>
		</u-modal>
		<u-modal v-model="showDel" content="是否要删除" title="确定要删除吗" :show-cancel-button="true"
			@confirm="throughConfirmDel" @cancel="showDel=false">
		</u-modal>
		<u-select mode="single-column" :list="shShowList" v-model="shShow" @confirm="shShowConfirm"
			value-name="value" label-name="name"></u-select>
		<u-select mode="single-column" :list="jsShowList" v-model="jsShow" @confirm="jsShowConfirm"
			value-name="value" label-name="name"></u-select>
		<u-picker v-model="showBegin1" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm1"></u-picker>
		<u-picker v-model="showBegin2" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm2"></u-picker>
		<u-picker v-model="showBegin3" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm3"></u-picker>
		<u-picker v-model="showBegin4" mode="time" :default-time="defaultTime" :params="params" @confirm="confirm4"></u-picker>
		<u-top-tips ref="uTips" z-index="999999"></u-top-tips>
		<u-modal v-model="picNameShow" content="输入图片名称" title="输入图片名称" :show-cancel-button="false"
			@confirm="picNameConfirmDel" >
			<u-form  label-width="100px">
				<u-form-item label="图片名称:" >
					<u-input v-model="picName" placeholder="请输入图片名称"/>
				</u-form-item>
			</u-form>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				picName: '',		// 图片名称
				picNameShow: false,	// 图片名称控制器
				insertshow: false,	// 控制驳船附件的显示
				upPicShow: false,	// 控制已上传图片显示
				tabList: ['商务核销','待生产部审核', '已完成', '已废除'],
				current: 0, 
				orderList: [],
				tel: '',
				flag: false,
				level: '',
				department: '',
				portname: '',
				show: false,
				showInfo: false,
				title: '',
				content: '',
				obj: {},
				carItem: {},
				reason: '',
				fileDate1: [],
				uploadList: [],			// 上传的图片
				pic1: [],				// 预览的图片
				pic2: [],
				fileDate2: [],
				jsShow: false,
				shShow: false,
				showBegin1: false,
				showBegin2: false,
				showBegin3: false,
				showBegin4: false,
				defaultTime: '',
				stateShow: '', 		// 详细界面审核状态

				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				infoId: '',	
				formData: {},
				form: {
					mmsicod: ''
				},		// 查看详细
				remark: '',				// 当前有权限人的名称nickname
				remarkName: '',			// 对应name
				showReason: false,		// 审核拒绝的控制器
				reason: '',				// 审核拒绝的理由
				idShip: '',				// 船的id
				showDel: false,			// 删除提示框
				delObj: {},
				manageShow: false,		// 审核和反审核权限
				action: 'https://api.zlkj-port.com/ZLBG/common/upload1',				// 图片上传地址
				shShowList: [
					{ name: '所有', value: '' },
				    { name: '待审核', value: '1' },
				    { name: '已审核', value: '2' },
					{ name: '已驳回', value: '3' }, 
				],
				jsShowList: [
					{ name: '所有', value: '' },
				    { name: '白名单', value: '1' },
				    { name: '黑名单', value: '2' },
				],
				customStyle: {
					height: '60rpx',
				}, 
				customTimeStyle: {
					height: '60rpx',
				},
				rules: {
					bargenam: [ { required: true, message: '船舶名称不能为空' } ],
					shipsbcod: [ { required: true, message: '船舶识别码不能为空' } ],
					shiplength: [ { required: true, message: '船舶总长不能为空,只能输入数字', type: 'float' } ],
					shipwidth: [ { required: true, message: '船舶宽度不能为空,只能输入数字', type: 'float' } ],
					freeboard: [ { required: true, message: '核定干舷不能为空,只能输入数字', type: 'float' } ],
					shipregistport: [ { required: true, message: '船籍港不能为空' } ],
					shipnet: [ { required: true, message: '船舶总吨不能为空,只能输入数字', type: 'float' } ],
					shipdraft: [ { required: true, message: '满载吃水不能为空,只能输入数字', type: 'float' } ],
					loadtonnage: [ { required: true, message: '参考载货量不能为空,只能输入数字', type: 'float' } ],
					shipoper: [ { required: true, message: '船舶所有人不能为空' } ],
					shipcorp: [ { required: true, message: '船舶经营人不能为空' } ],
					mmsicod: [ { required: true, message: 'MMSI码不能为空,只能输入数字', type: 'float' } ],
					maximumheight: [ { required: true, message: '最大高度不能为空,只能输入数字', type: 'float' } ],
					shipbuilddate: [ { required: true, message: '船舶建造日期不能为空' } ],
					cjzsyxq: [ { required: true, message: '船籍证有效期不能为空' } ],
					shzsyxq: [ { required: true, message: '适航证有效期不能为空' } ],
					diantaiDate: [ { required: true, message: '电台执照有效期不能为空' } ],
				},
			};
		},
		onLoad(options) {
			//uni.getStorageSync("userInfo").mobile
			this.tel = uni.getStorageSync("userInfo").mobile
			this.getState1()
			this.getUserAllow()
			this.power()
		},
		onReady() {
			this.$refs.Form.setRules(this.rules)
		},
		methods: {
			// 当前操作人的账户
			getUserAllow(){
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/concat/getInfo',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						telNumber: this.tel
					},
					success: (res) => {
						console.log(res)
						this.remark = res.data.remark
						this.remarkName = res.data.remarkName
						console.log(this.remark)
					} 
				})
			},
			// 驳船审核人的权限-审核反审核-黑白名单切换
			power() {
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/concat/getShipInfo/' + this.tel,
					method: 'get',
					success: (res) => {
						if(res.data){
							this.manageShow = true
						}
					}
				})
			},
			// 上传成功回调函数
			handleSuccess(response) {
				this.uploadList.push({
					name: response.originalFilename,
					url: response.url
				})
			},
			// 图片名称确定
			picNameConfirmDel() {
				console.log(this.maxCount-2)
				console.log(this.uploadList[this.maxCount-2])
				if(this.picName) {
					this.uploadList[this.maxCount-2].name = this.picName
					this.picNameShow = false
					this.picName = ''		// 清空图片名称
					console.log('111:', this.uploadList)
				} else {
					this.$refs.uTips.show({
						title: '请输入图片名称，图片名称不能为空！',
						type: 'warning',
						duration: '2300'
					})
					this.picNameShow = true
				}
			},
			// 移除图片的时候触发
			handleRemove(index, lists, name) {
				console.log('被移除:', index, lists, name)
				this.uploadList.splice(index, 1);
				console.log(this.uploadList)
			},
			shShowConfirm(e) {
				this.formData.checkStatusLabel = e[0].label
				this.formData.checkStatus = e[0].value
			},
			jsShowConfirm(e) {
				this.formData.statusLabel = e[0].label
				this.formData.status = e[0].value
			},
			// 时间确认按钮
			confirm1(val) {
				this.form.shipbuilddate = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.shipbuilddate)
			},
			confirm2(val) {
				this.form.cjzsyxq = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.cjzsyxq)
			},
			confirm3(val) {
				this.form.shzsyxq = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.shzsyxq)
			},
			confirm4(val) {
				this.form.diantaiDate = val.year + '-' + val.month + '-' + val.day
				console.log(this.form.diantaiDate)
			},
			onSearch(){
				this.getState1()
			},
			previewImage(e, index, num) {
				uni.previewImage({
					// 需要预览的图片链接列表。若无需预览，可以注释urls
					urls: num == 1 ? this.pic1 : this.pic2,
					// 为当前显示图片的链接/索引值
					current: index,
					// 图片指示器样式	
					indicator: 'default',
					// 是否可循环预览
					loop: false,
					success: res => {
						console.log('previewImage res', res);
					},
					fail: err => {
						console.log('previewImage err', err);
					}
				});
			},
			// 删除图片
			deletePic(item) {
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/deletebguploadfilesbyid',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: item.id
					},
					success: (res) => {
						uni.request({
							url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
							method: 'post',
							header: {
								'Content-Type': 'application/json;charset=UTF-8'
							},
							data: {
								bgBargeid: this.infoId,
								typ: '驳船'
							},
							success: (res) => {
								this.$refs.uTips.show({
									title: '删除成功！',
									type: 'success',
									duration: '2300'
								})
								this.pic1 = []
								this.fileDate1 = JSON.parse(JSON.stringify(res.data))
								this.fileDate1.forEach(item => {
									this.pic1.push(item.url)
								})
							}
						})
					}
				})
			},
			// 查看详细
			toMoreInfo(item) {
				this.infoId = item.id
				this.pic1 = []
				this.upPicShow = false
				this.insertshow = true
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/' + item.id,
					method: 'get',
					success: (res) => {
						this.form = res.data.data
						if (this.form.checkStatus == 1) this.stateShow = '待审核'
						if (this.form.checkStatus == 2) this.stateShow = '已审核'
						if (this.form.checkStatus == 3) this.stateShow = '已驳回'
						if(item.id) {
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/getbargefilesdata',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: {
									bgBargeid: item.id,
									typ: '驳船'
								},
								success: (res) => {
									this.fileDate1 = JSON.parse(JSON.stringify(res.data))
									this.fileDate1.forEach(item => {
										this.pic1.push(item.url)
									})
								}
							})
						}
						this.showInfo = true
						console.log(res)
					}
				})
			},
			// 修改
			toThroughSW(item) {
				console.log(item)
				if(item.checkStatus == 2) {
					this.$refs.uTips.show({
						title: '该船已经审合过了，可以点击详细看详细信息',
						type: 'warning',
						duration: '2300'
					})
					return
				}
				// 驳回的情况
				if(!item.belongto) {
					// 上传图片清空，获取上传图片，查看详细
					this.$nextTick(() => {
						// 清空图片
						this.$refs.uUpload.clear()
						this.uploadList = []
					})
					this.toMoreInfo(item)
					this.upPicShow = true
					this.insertshow = false
					return
				}
				// 没有驳回只能本人修改
				if(item.belongto && this.remark == item.belongto) {
					this.$nextTick(() => {
						// 清空图片
						this.$refs.uUpload.clear()
						this.uploadList = []
					})
					this.toMoreInfo(item)
					this.upPicShow = true
					this.insertshow = false
				} else {
					this.$refs.uTips.show({
						title: '该船不是你填报的船无法修改',
						type: 'warning',
						duration: '2300'
					})
				}	
			},
			// 新增
			onInsert() {
				this.form = {}
				this.upPicShow = false
				this.stateShow = ''
				this.insertshow = false
				this.$nextTick(() => {
					// 清空图片
					this.$refs.uUpload.clear()
					this.uploadList = []
				})
				this.showInfo = true
			},
			// 新增，修改提交
			submit() {
				this.$refs.Form.validate(valid => {
					if(valid) {
						if(this.form.id != null) {
							// 修改
							uni.showLoading({
								title: '加载中...'
							})
							this.form.bgUploadfiles = this.uploadList
							if (this.form.bgUploadfiles.length > 0) {
							    this.form.bgUploadfiles = this.form.bgUploadfiles.map(item => {
							    return { ...item, ...{ typ: '驳船' } }
								})
							    console.log(this.form.bgUploadfiles)
							}
							this.form.creater = this.remarkName
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/update',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: this.form,
								success: (res) => {
									uni.hideLoading()
									this.getState1()
									this.showInfo = false
									this.uploadList = [] // 清空上传的图片
									this.$refs.uTips.show({
										title: '修改成功',
										type: 'success',
										duration: '2300'
									})
								},
								error: (error) => {
									uni.hideLoading()
								}
							})
						} else {
							// 新增
							// 图片
							// 判断是否重复
							uni.request({
								url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/selectListForApplay2',
								method: 'post',
								header: {
									'Content-Type': 'application/json;charset=UTF-8'
								},
								data: {
									pageNum: 1, 
									pageSize: 100,
									bargenam: this.form.bargenam 
								},
								success: (res) => {
									console.log(res)
									if(res.data.rows.length > 0) {
										this.$refs.uTips.show({
											title: '该船已经填报过了！不能填报同一条船！',
											type: 'warning',
											duration: '2300'
										})
									} else {
										uni.showLoading({
											title: '加载中...'
										})
										this.form.bgUploadfiles = this.uploadList
										if (this.form.bgUploadfiles.length > 0) {
										    this.form.bgUploadfiles = this.form.bgUploadfiles.map(item => {
										    return { ...item, ...{ typ: '驳船' } }
											})
										    console.log(this.form.bgUploadfiles)
										}
										this.form.belongto = this.remark
										this.form.creator = this.remark
										this.form.creater = this.remarkName
										uni.request({
										 	url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge',
											method: 'post',
											header: {
												'Content-Type': 'application/json;charset=UTF-8'
											},
											data: this.form,
											success: (res) => {
												uni.hideLoading()
												this.getState1()
												this.uploadList = []	// 清空上传的图片
												this.showInfo = false
												this.$refs.uTips.show({
													title: '新增成功',
													type: 'success',
													duration: '2300'
												})
											},
											error: () => {
												uni.hideLoading()
											}
										 })
									}
								}
							})
							
						}
					}
				})
			},
			// 搜索海事船舶
			onConfirm(event){
				try {
					uni.showLoading({
						title: '加载中...'
					})
					uni.request({
						url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/shipList/' + this.form.bargenam,
						method: 'get',
						success: (res) => {
							console.log(res)
							if (res.data.rows.code == '0') {
								this.$refs.uTips.show({
									title: res.data.rows.msg,
									type: 'warning',
									duration: '2300'
								})
							    uni.hideLoading()
							    return
							}
							if (res.data.rows.shipInfo.mmsi) {
							    this.form.mmsicod = res.data.rows.shipInfo.mmsi
							    this.form.shipsbcod = res.data.rows.shipInfo.shipId
							    this.form.shipId = res.data.rows.shipInfo.shipId
							    this.form.nationCode = res.data.rows.shipInfo?.nationCode ?? this.form.nationCode
							    this.form.nationCodeCn = res.data.rows.shipInfo?.nationCodeCn ?? this.form.nationCodeCn
							    this.form.shiplength = res.data.rows.shipInfo?.shipLength ?? this.form.shiplength
							    this.form.shipTypeCodeCn = res.data.rows.shipInfo?.shipTypeCodeCn ?? this.form.shipTypeCodeCn
							    this.form.shipoper = res.data.rows.shipInfo?.shipOwner ?? this.form.shipoper
							    this.form.tel = res.data.rows.shipInfo?.shipContactsTel ?? this.form.tel
							    this.form.sailingareaCode = res.data.rows.shipInfo?.sailingareaCode ?? this.form.sailingareaCode
							    this.form.sailingareaCodeCn = res.data.rows.shipInfo?.sailingareaCodeCn ?? this.form.sailingareaCodeCn
							    this.form.shipTypeCode = res.data.rows.shipInfo?.shipTypeCode ?? this.form.shipTypeCode
							    this.form.shipRegNo = res.data.rows.shipInfo?.shipRegNo ?? this.form.shipRegNo
							    this.form.shipwidth = res.data.rows.shipInfo?.shipBreadth ?? this.form.shipwidth
							    this.form.shipregistport = res.data.rows.shipInfo?.regportCodeCn ?? this.form.shipregistport
							    this.form.shipnet = res.data.rows.shipInfo?.shipGrosston ?? this.form.shipnet
							    this.form.shipdraft = res.data.rows.shipInfo?.shipSummerDraft ?? this.form.shipdraft
							    this.form.loadtonnage = res.data.rows.shipInfo?.shipDwt ?? this.form.loadtonnage
							    this.form.shipcorp = res.data.rows.shipInfo?.hipOperator ?? this.form.shipcorp
							    this.form.maximumheight = res.data.rows.shipInfo?.maxHigh ?? this.form.maximumheight
							    this.form.shipRegionType = res.data.rows.shipInfo?.shipRegionType ?? this.form.shipRegionType
							    this.$forceUpdate()	// 强制视图更新
								uni.hideLoading()
								this.$refs.uTips.show({
							    	title: res.data.rows.msg,
							    	type: 'success',
							    	duration: '2300'
							    })
							} else {
								uni.hideLoading()
								this.$refs.uTips.show({
									title: 'mmsi码不存在',
									type: 'success',
									duration: '2300'
								})
							}
						},
						error: (error) => {
							uni.hideLoading()
						}
					})
				} catch(error){
					uni.hideLoading()
				}
				
				
			},
			// 黑白名单切换
			toThrough(item) {
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/setStatus',
					method: 'post',
					data: {
						id: item.id,
						status: item.status
					},
					success: (res) => {
						this.getState1()
						uni.hideLoading()
						this.$refs.uTips.show({
							title: '修改成功！',
							type: 'success',
							duration: '2300'
						})
					}
				})
			},
			// 删除
			toParse(item) {
				if(item.checkStatus == 2){
					this.$refs.uTips.show({
						title: '该船已经审核通过，无法进行操作！',
						type: 'warning',
						duration: '2300'
					})
					return
				}
				this.showDel = true
				this.delObj = item
			},
			throughConfirmDel() {
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/delBarge',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: this.delObj.id,
						bgId: this.delObj.bgId
					},
					success: (res) => {
						this.showReason = false
						this.getState1()
						uni.hideLoading()
						this.$refs.uTips.show({
							title: '删除成功！',
							type: 'success',
							duration: '2300'
						})
					}
				})
			},
			// 审核
			toSH(row){
				console.log(row)
				uni.showLoading({
					title: '加载中...'
				})
				
				// 设置状态
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/setCheckStatus2',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: this.form.id,
						uname: this.remark
					},
					success: (res) => {
						uni.request({
							url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/update',
							method: 'post',
							header: {
								'Content-Type': 'application/json;charset=UTF-8'
							},
							data: this.form,
							success: (res) => {
								this.getState1()
								uni.hideLoading()
								this.showInfo = false
								this.$refs.uTips.show({
									title: '审核通过！',
									type: 'success',
									duration: '2300'
								})
							}
						})
					}
				})
			},
			// 反审核
			toResolve(row){
				this.idShip = row.id
				this.showReason = true
			},
			throughConfirm(){
				uni.showLoading({
					title: '加载中...'
				})
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/setCheckStatus3',
					method: 'post',
					header: {
						'Content-Type': 'application/json;charset=UTF-8'
					},
					data: {
						id: this.idShip,
						checkMemo: this.reason,
						uname: this.remark
					},
					success: (res) => {
						this.showReason = false
						this.getState1()
						uni.hideLoading()
						this.showInfo = false
						this.$refs.uTips.show({
							title: '该船已被驳回！',
							type: 'success',
							duration: '2300'
						})
					}
				})
			},
			beforeUpload(index, list) {
				console.log(list)
			},
			getState1() {
				uni.showLoading({
					title: '加载中...'
				})
				let params = {
				  pageNum: 1,
				  pageSize: 100,
				  status: this.formData.status,
				  checkStatus: this.formData.checkStatus,
				  shipsbcod: this.formData.shipsbcod,
				  bargenam: this.formData.bargenam,
				}
				if (!params.status) delete params.status
				if (!params.checkStatus) delete params.checkStatus
				if (!params.shipsbcod) delete params.shipsbcod
				if (!params.bargenam) delete params.bargenam
				
				uni.request({
					url: 'https://api.zlkj-port.com/ZLBG/zlkj/bg_barge/list',
					method: "get",
					data: params,
					success: (res) => {
						console.log(res.data)
						this.orderList = JSON.parse(JSON.stringify(res.data.rows))
						this.orderList.map(val => {
							if (val.checkStatus == 1 || val.checkStatus == 3) {
							    val.SHText = '审核'
							} else if (val.checkStatus == 2) {
							    val.SHText = '返审核'
							}
							return val
						})
						uni.hideLoading()
					}
				})
				
			},
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #F2F1F9;
	}
	#finsihPic {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.headForm {
		padding: 20rpx;
		position: fixed;
		width: 100%;
		top: 0;
		z-index: 10;
		background-color: #FFFFFF;
	
		.btnGroup {
			display: flex;
			justify-content: space-around;
			align-items: center;
			margin-top: 15rpx;
		}
	}
	.picContent {
	    display: flex;
	    flex-wrap: wrap;
	    overflow: auto;
	    // height: 400rpx;
	    justify-content: center;
	    .pic {
	      margin: 5px;
	    }
	  } 
	.font {
		margin: 5px 0;
		font-size: 16px;
	}
	::v-deep .u-form-item{
		padding: 10rpx 20rpx !important;
	}
	::v-deep .u-model__content__message {
		padding: 0 !important;
	}
	.btn {
		background-color: rgb(25, 190, 107); 
		color: #fff; 
		width: 150rpx;
		height: 55rpx;
		line-height: 55rpx;
		text-align: center;
		border-radius: 5px;
		margin-left: 10px;
	}

	.mainCon {
		.tabHead {
			margin: 0 auto;
			display: flex;
			align-items: center;
			justify-content: space-evenly;
			padding: 20rpx;
			position: fixed;
			top: 0;
			width: 100%;
			// background-color: #FFFFFF;

			.tabItem {
				width: 160rpx;
				line-height: 50rpx;
				border-radius: 25rpx;
				text-align: center;
				border: 1rpx solid #1A75FF;
				color: #868887;
				font-size: 26rpx;
			}

			.active {
				background-color: #1A75FF;
				color: #FFFFFF;
			}
		}

		.orderList {
			width: 700rpx;
			margin: 20rpx auto;
			margin-top: 100rpx;
			.orderItem {
				background-color: #FFFFFF;
				padding: 20rpx;
				border-radius: 12rpx;
				margin-bottom: 20rpx;

				.orderHead {
					.headcell {
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-bottom: 10rpx;

						.leftCon {
							display: flex;
							align-items: center;

							.labelTag {
								background-color: #E0EDFB;
								color: #4C86E7;
								width: 150rpx;
								line-height: 50rpx;
								border-radius: 25rpx;
								font-size: 26rpx;
								text-align: center;
								margin-right: 15rpx;
							}
						}

						.status1 {
							color: #4C86E7;
							font-size: 26rpx;
						}

						.dateLabel {
							color: #858585;
						}

						.status2 {
							color: #E94340;
							font-size: 30rpx;
						}
					}
				}

				.orderInfo {
					margin-top: 20rpx;
					border-top: 1rpx dashed #C1C3C2;
					padding-top: 20rpx;

					.infoCell {
						display: flex;
						align-items: center;
						margin-bottom: 10rpx;

						.labelTag {
							background-color: #E0EDFB;
							color: #4C86E7;
							width: 150rpx;
							line-height: 50rpx;
							border-radius: 25rpx;
							font-size: 26rpx;
							text-align: center;
							margin-right: 15rpx;
						}

						.labelName {
							color: #858585;
							font-size: 28rpx;
							margin-right: 50rpx;
							width: 195rpx;
						}

						.infoCon {
							color: #87888A;
						}
					}
				}

				.bottomActions {
					margin-top: 50rpx;
					display: flex;
					align-items: center;
					justify-content: center;

					.delete {
						width: 300rpx;
						line-height: 60rpx;
						text-align: center;
						border: 1rpx solid #5B92E8;
						color: #5B92E8;
						border-radius: 30rpx;
						margin: 0 30rpx;
					}

					.confirm {
						width: 300rpx;
						line-height: 60rpx;
						text-align: center;
						border: 1rpx solid #5B92E8;
						color: #5B92E8;
						border-radius: 30rpx;
						margin: 0 30rpx;
					}
				}
			}
		}
	}
</style>
